package cn.iocoder.devlop.module.annual.report.wsbaseinfo.controller.app;

import cn.iocoder.devlop.framework.common.pojo.CommonResult;
import cn.iocoder.devlop.framework.common.pojo.PageResult;
import cn.iocoder.devlop.framework.excel.core.util.ExcelUtils;
import cn.iocoder.devlop.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.devlop.module.annual.report.wsbaseinfo.controller.vo.*;
import cn.iocoder.devlop.module.annual.report.wsbaseinfo.service.WsBaseinfoService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import static cn.iocoder.devlop.framework.common.pojo.CommonResult.success;
import static cn.iocoder.devlop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;

@Tag(name = "用户 APP - 外商投资基本信息")
@RestController
@RequestMapping("/annual/report/ws-baseinfo")
@Validated
public class AppWsBaseinfoController {

    @Resource
    private WsBaseinfoService wsBaseinfoService;



    @PutMapping("/update-wsbaseinfo")
    @Operation(summary = "更新外商基本信息")
    public CommonResult<Boolean> updateBaseinfo(@Valid @RequestBody WsBaseinfoUpdateVO updateReqVO) {
        wsBaseinfoService.updateBaseinfo(updateReqVO);
        return success(true);
    }


    @PutMapping("/update-wsassetsliabilitiesinfo")
    @Operation(summary = "更新外商资产信息")
    public CommonResult<Boolean> updateAssetsLiabilitiesinfo(@Valid @RequestBody WsAssetsLiabilitiesinfoVO updateReqVO) {
        wsBaseinfoService.updateAssetsLiabilitiesinfo(updateReqVO);
        return success(true);
    }

    @PutMapping("/update-wsdebtinfo")
    @Operation(summary = "更新外商负债信息")
    public CommonResult<Boolean> updateDebtinfo(@Valid @RequestBody WsDebtinfoUpdateVO updateReqVO) {
        wsBaseinfoService.updateDebtinfo(updateReqVO);
        return success(true);
    }

    @PutMapping("/update-wsdutyfreeinfo")
    @Operation(summary = "更新外商进口设备减免信息")
    public CommonResult<Boolean> updateDutyFreeinfo(@Valid @RequestBody WsDutyFreeinfoUpdateVO updateReqVO) {
        wsBaseinfoService.updateDutyFreeinfo(updateReqVO);
        return success(true);
    }

    @PutMapping("/update-wsoperateinfo")
    @Operation(summary = "更新外商投资经营情况")
    public CommonResult<Boolean> updateOperateinfo(@Valid @RequestBody WsOperateinfoUpdateVO updateReqVO) {
        wsBaseinfoService.updateOperateinfo(updateReqVO);
        return success(true);
    }


    @GetMapping("/get-wsbaseinfo")
    @Operation(summary = "获得外商基本信息")
    public CommonResult<WsBaseinfoUpdateVO> getBaseinfo(@RequestParam("regno") String regno, @RequestParam("ancheyear") String ancheyear) {
        return success(wsBaseinfoService.getWsBaseinfo(regno, ancheyear));
    }

    @GetMapping("/get-wsassetsliabilitiesinfo")
    @Operation(summary = "获得外商资产信息")
    public CommonResult<WsAssetsLiabilitiesinfoVO> getAssetsLiabilitiesinfo(@RequestParam("regno") String regno, @RequestParam("ancheyear") String ancheyear) {
        return success(wsBaseinfoService.getAssetsLiabilitiesinfo(regno, ancheyear));
    }


    @GetMapping("/get-wsdebtinfo")
    @Operation(summary = "获得外商负债信息")
    public CommonResult<WsDebtinfoUpdateVO> getDebtinfo(@RequestParam("regno") String regno, @RequestParam("ancheyear") String ancheyear) {
        return success(wsBaseinfoService.getDebtinfo(regno, ancheyear));
    }


    @GetMapping("/get-wsdutyfreeinfo")
    @Operation(summary = "获得外商进口设备减免信息")
    public CommonResult<WsDutyFreeinfoUpdateVO> getDutyFreeinfo(@RequestParam("regno") String regno, @RequestParam("ancheyear") String ancheyear) {
        return success(wsBaseinfoService.getDutyFreeinfo(regno, ancheyear));
    }

    @GetMapping("/get-wsoperateinfo")
    @Operation(summary = "获得外商投资经营情况")
    public CommonResult<WsOperateinfoUpdateVO> getOperateinfo(@RequestParam("regno") String regno, @RequestParam("ancheyear") String ancheyear) {
        return success(wsBaseinfoService.getOperateinfo(regno, ancheyear));
    }

}
